package com.xu.ai.model.dashscope.exception;

import java.util.Objects;

/**
 * ai exception
 *
 * @author xuguan
 * @since 2025/10/15
 */
public class AiException extends RuntimeException {

	private String code;

	public AiException() {
		super();
	}

	public AiException(String message) {
		super(message);
	}

	public AiException(String message, Throwable cause) {
		super(message, cause);
	}

	public AiException(String code, String message) {
		super(message);
		this.code = code;
	}

	public AiException(String code, String message, Throwable cause) {
		super(message, cause);
		this.code = code;
	}

	@Override
	public String toString() {
		if (Objects.isNull(code)) {
			return getMessage();
		}
		return String.format("AiException{%s: %s} ", code, getMessage());
	}

}
